package org.example.translate_braille.resdata;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description="返回信息对象")
public class X<T> {

    @ApiModelProperty(value = "返回编码")
    private Integer code;
    @ApiModelProperty(value = "返回标注")
    private String msg;
    @ApiModelProperty(value = "返回数据")
    private T data;

    public static <T> X ResData(Integer code, String msg, T data){
        return new X(code,msg,data);
    }

    public static <T> X ResData(DataEnum dataenum, T data){
        return new X(dataenum.getCode(),dataenum.getMsg(),data);
    }
}
